import 'package:flutter/material.dart';

class TextShow extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(
        title: new Text("文字"),
      ),
      body: new Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new Container(
            padding: EdgeInsets.all(10),
            child: Text(
              "对齐方式，居中显示。" * 6,
              textAlign: TextAlign.center,
            ),
          ),
          new Container(
            padding: EdgeInsets.all(10),
            child: new Text(
              "超过一行显示三个点。" * 6,
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
            ),
          ),
          new Container(
            padding: EdgeInsets.all(10),
            child: new Text(
              "文字放大两倍",
              textScaleFactor: 2,
            ),
          ),
          new Container(
            padding: EdgeInsets.all(10),
            child: new Text(
              "带样式的文本",
              style: TextStyle(
                  color: Colors.blue,
                  fontSize: 17,
                  height: 1.2,
                  background: new Paint()..color = Colors.red,
                  decoration: TextDecoration.lineThrough,
                  decorationStyle: TextDecorationStyle.solid),
            ),
          ),
          new Container(
            padding: EdgeInsets.all(10),
            child: Text.rich(TextSpan(children: [
              TextSpan(text: "this is "),
              TextSpan(text: "a red apple.", style: TextStyle(color: Colors.red),),
            ]
            )
            ),
          ),
        ]
      ),
    );
  }
}
